/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmAsigProfe.java
 *
 * Created on 16/02/2011, 04:38:41 PM
 */
package Principal;

import java.awt.Frame;

import javax.swing.JOptionPane;

import Clases.Profesor;
import Clases.Seccion;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */

public class frmAsigProfe extends javax.swing.JFrame {

	{
		// Set Look & Feel
		try {
			javax.swing.UIManager
					.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public frmAsigProfe() {
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jLabel5 = new javax.swing.JLabel();
		txtTitulo = new javax.swing.JTextField();
		txtApellido = new javax.swing.JTextField();
		txtNombre = new javax.swing.JTextField();
		txtCedula = new javax.swing.JTextField();
		bAgregar = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		setAlwaysOnTop(true);
		getContentPane().setLayout(null);

		jLabel1.setText("Cedula");
		getContentPane().add(jLabel1);
		jLabel1.setBounds(162, 77, 70, 20);

		jLabel2.setText("Nombre");
		getContentPane().add(jLabel2);
		jLabel2.setBounds(155, 127, 70, 20);

		jLabel3.setText("Apellido");
		getContentPane().add(jLabel3);
		jLabel3.setBounds(154, 173, 88, 20);

		jLabel4.setText("Titulo Acedemico");
		getContentPane().add(jLabel4);
		jLabel4.setBounds(91, 217, 145, 20);

		jLabel5.setText("Registro de Profesor");
		getContentPane().add(jLabel5);
		jLabel5.setBounds(208, 20, 134, 15);
		jLabel5.setBackground(new java.awt.Color(255, 255, 255));
		getContentPane().add(txtTitulo);
		txtTitulo.setBounds(221, 218, 170, 20);

		txtApellido.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				txtApellidoActionPerformed(evt);
			}
		});
		getContentPane().add(txtApellido);
		txtApellido.setBounds(221, 174, 170, 20);
		getContentPane().add(txtNombre);
		txtNombre.setBounds(221, 128, 170, 20);

		txtCedula.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				txtCedulaActionPerformed(evt);
			}
		});
		getContentPane().add(txtCedula);
		txtCedula.setBounds(221, 78, 170, 20);

		bAgregar.setText("Agregar y salir");
		bAgregar.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				bAgregarActionPerformed(evt);
			}
		});
		getContentPane().add(bAgregar);
		bAgregar.setBounds(170, 290, 130, 50);

		java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit()
				.getScreenSize();
		setBounds((screenSize.width - 489) / 2, (screenSize.height - 405) / 2,
				489, 405);
	}// </editor-fold>//GEN-END:initComponents

	private void bAgregarActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_bAgregarActionPerformed
		// TODO add your handling code here:
		if (!txtCedula.getText().isEmpty() && !txtNombre.getText().isEmpty()
				&& !txtApellido.getText().isEmpty()
				&& !txtTitulo.getText().isEmpty()) {
			frmInicial.profesor = new Profesor(txtNombre.getText(),
					txtApellido.getText(), txtCedula.getText(),
					txtTitulo.getText());
			// sec.AsignarProfesor(profe);
			frmInicial.seccion.AsignarProfesor(frmInicial.profesor);
			JOptionPane.showMessageDialog(new Frame(), "Profesor Asignado");
			dispose();

		} else {
			JOptionPane.showMessageDialog(new Frame(),
					"Hay campos en blanco, por favor verifique");
		}
	}// GEN-LAST:event_bAgregarActionPerformed

	private void txtApellidoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_txtApellidoActionPerformed
		// TODO add your handling code here:
	}// GEN-LAST:event_txtApellidoActionPerformed

	private void txtCedulaActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_txtCedulaActionPerformed
		// TODO add your handling code here:
	}// GEN-LAST:event_txtCedulaActionPerformed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {

			public void run() {
				new frmAsigProfe().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton bAgregar;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JTextField txtApellido;
	private javax.swing.JTextField txtCedula;
	private javax.swing.JTextField txtNombre;
	private javax.swing.JTextField txtTitulo;
	// End of variables declaration//GEN-END:variables
}
